package values.avatar
{
import com.adobe.utils.ArrayUtil;

/**
 * AvatarSkillConfigValue
 * @author jliang
 *
 */
public class AvatarSkillConfigValue
{
	public var owner:AvatarTemplateValue;
	
	[Data(type="field", mapping="@normal", method="stringToArray")]
	public var normalSkills:Array;
	
	[Data(type="field", mapping="@default_normal_skill")]
	public var defaultNormalSkill:String;
	
	[Data(type="field", mapping="@ultimate")]
	public var ultimateSkill:String;
	
	public function hasSkill(key:String):Boolean
	{
		return ArrayUtil.arrayContainsValue(normalSkills, key);
	}
	
	public function getSkillSlot(key:String):int
	{
		if (key == ultimateSkill) return -1;
		
		return normalSkills.indexOf(key);
	}
}
}